#pragma once
#include <QHash>
#include <QString>
#include <QSharedPointer>

#include "commandconfig.h"
#include "connectionconfig.h"

namespace apollo
{
	namespace core
	{
		class SystemConfig
		{
		public:
			SystemConfig(void);
			~SystemConfig(void);
		public:
			QHash<QString, QSharedPointer<CommandConfig> >& getCommandConfigs(){return commandConfigs;}
			QHash<QString, QSharedPointer<ConnectionConfig> > & getConnectionConfigs() { return connectionConfigs;}
			QSharedPointer<CommandConfig> getCommandConfig(const QString &commandName)
			{
				return commandConfigs.value(commandName, QSharedPointer<CommandConfig>(NULL));
			}

			QSharedPointer<ConnectionConfig> getConnectionConfig(const QString &connName)
			{
				return connectionConfigs.value(connName, QSharedPointer<ConnectionConfig>(NULL));
			}

			void addCommandConfig(const QString &commandName, QSharedPointer<CommandConfig> &commandConfig)
			{
				commandConfigs[commandName] = commandConfig;
			}

			void addCommandConfig(const QString &connName, QSharedPointer<ConnectionConfig> &connConfig)
			{
				connectionConfigs[connName] = connConfig;
			}

		private:
			QHash<QString, QSharedPointer<CommandConfig> > commandConfigs;
			QHash<QString, QSharedPointer<ConnectionConfig> > connectionConfigs;
		};
	}}
